package com.hmy.finance.dal.po.receipt;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hmy.finance.api.bo.core.request.enums.OffsetVoucherStatusEnum;
import com.hmy.finance.dal.po.json.VoucherAttachmentJsonArrayHandler;
import com.hmy.finance.dal.po.json.VoucherAttachmentsJson;
import lombok.Data;
import org.apache.ibatis.type.EnumTypeHandler;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 收款凭证
 *
 * @TableName receipt_voucher
 */
@TableName(value = "receipt_voucher", autoResultMap = true)
@Data
public class ReceiptVoucherPo implements Serializable {
    /**
     * 主键ID
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 凭证编号
     */
    @TableField(value = "voucher_no")
    private String voucherNo;

    /**
     * 凭证金额
     */
    @TableField(value = "voucher_amount")
    private BigDecimal voucherAmount;

    /**
     * 已核销金额
     */
    @TableField(value = "offset_amount")
    private BigDecimal offsetAmount;

    /**
     * 未核销金额
     */
    @TableField(value = "un_offset_amount")
    private BigDecimal unOffsetAmount;

    /**
     * 收款日期
     */
    @TableField(value = "receipt_date")
    private LocalDateTime receiptDate;

    /**
     * 收款方式，见数据字典：hmy-finance:receipt.voucher.type
     */
    @TableField(value = "payment_type")
    private Integer paymentType;

    /**
     * 凭证附件，存储附件链接集合
     */
    @TableField(value = "attachments", typeHandler = VoucherAttachmentJsonArrayHandler.class)
    private List<VoucherAttachmentsJson> attachments;

    /**
     * 核销状态，未核销、部分核销、已核销
     */
    @TableField(value = "voucher_offset_status", typeHandler = EnumTypeHandler.class)
    private OffsetVoucherStatusEnum offsetStatus;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 创建人ID
     */
    @TableField(value = "creator_id")
    private Long creatorId;

    /**
     * 创建人姓名
     */
    @TableField(value = "creator_name")
    private String creatorName;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    /**
     * 更新人ID
     */
    @TableField(value = "updater_id")
    private Long updaterId;

    /**
     * 更新人姓名
     */
    @TableField(value = "updater_name")
    private String updaterName;

    /**
     * 是否删除，0-否；1-是
     */
    @TableField(value = "is_deleted")
    private Integer isDeleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}